const initialState = {
    list:[],
    serlist:[],
    serdata:[]
}

export default (state = initialState, { type, payload }:any) => {
const newState = JSON.parse(JSON.stringify(state))
  switch (type) {
  case 'ADD_LIST' :
    newState.list = payload
    return newState
  case 'SER_LIST' :
    newState.serlist = payload
    newState.serdata=payload
    return newState
  case 'SERLIST' :
    newState.serdata=newState.serlist.filter((value:any, index:number) => {
      return value.title.includes(payload)
    })
    return newState
  default:
    return newState
  }
}
